{% set site = device[short_name].site %}
!
hostname {{short_name}}
!
router ospf 1
 router-id 192.168.{{site}}.{{site}}
 redistribute bgp {{ device[short_name].local_as }} subnets
!
interface Loopback0
 ip address 192.168.{{ site }}.{{ site }} 255.255.255.255
!
interface Tunnel0
 ip address {{ device[short_name].ospf_tunnel_ip }} 255.255.255.0
 ip mtu 1476
 ip tcp adjust-mss 1360
 ip ospf 1 area 0
 tunnel source GigabitEthernet1
 tunnel destination {{ device[short_name].ospf_tunnel_destination }}
!
interface Tunnel1
 ip address {{ device[short_name].bgp_tunnel_ip }} 255.255.255.0
 tunnel source GigabitEthernet1
 tunnel destination {{ device[short_name].bgp_tunnel_destination }}
!
{% set neighbor = device[short_name].bgp_neighbor %}
router bgp {{ device[short_name].local_as }}
 bgp router-id 192.168.{{site}}.{{site}}
 bgp log-neighbor-changes
 neighbor {{ device[neighbor].bgp_tunnel_ip }} remote-as {{ device[neighbor].local_as }}
 neighbor {{ device[neighbor].bgp_tunnel_ip }} ebgp-multihop 255
!
 address-family ipv4
  redistribute ospf 1
  neighbor {{ device[neighbor].bgp_tunnel_ip }} activate
  network 192.168.{{site}}.{{site}} mask 255.255.255.255
  network {{ (device[short_name].ospf_tunnel_ip ~ '/24') | ansible.utils.ipaddr('network') }} mask 255.255.255.0
  network 10.200.200.0 mask 255.255.255.0
  network {{ (private_ip ~ '/16') | ansible.utils.ipaddr('network') }}
 exit-address-family
